package com.bright.hxj.qchz.pojo.bo;

import java.util.List;

public class DuijieReturnMsg {

    private boolean successFlag = false; // 标记结果是成功还是异常 成功的情况可通过data返还值 异常的情况可通过noRoleInfo和noRoleInfoList返回异常信息

    private String noRoleInfo;
    private List<String> noRoleInfoList;

    private Object data;

    public List<String> getNoRoleInfoList() {
        return noRoleInfoList;
    }

    public void setNoRoleInfoList(List<String> noRoleInfoList) {
        this.noRoleInfoList = noRoleInfoList;
    }

    public boolean isSuccessFlag() {
        return successFlag;
    }

    public void setSuccessFlag(boolean successFlag) {
        this.successFlag = successFlag;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getNoRoleInfo() {
        return noRoleInfo;
    }

    public void setNoRoleInfo(String noRoleInfo) {
        this.noRoleInfo = noRoleInfo;
    }

    public DuijieReturnMsg(String noRoleInfo) {
//        super(noRoleInfo);
        this.noRoleInfo = noRoleInfo;
    }

    public DuijieReturnMsg(String noRoleInfo, List<String> noRoleInfoList) {
//        super(noRoleInfo);
        this.noRoleInfo = noRoleInfo;
        this.noRoleInfoList = noRoleInfoList;
    }

    public DuijieReturnMsg(boolean successFlag, Object data) {
//        super(null);
        this.successFlag = successFlag;
        this.data = data;
    }

    // 判断结果是否正常 对象为空也是结果正常
    public static boolean isSuccess(DuijieReturnMsg returnMsg) {
        return returnMsg == null || returnMsg.successFlag;
    }

    @Override
    public String toString() {
        return "结果：" + successFlag + (successFlag ? "" : "; 异常信息：" + noRoleInfo + " " + noRoleInfoList);
    }
}
